package com.heima.user.controller.v1;

import com.heima.common.constants.admin.AdminConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.user.dtos.AuthDTO;
import com.heima.user.service.ApUserRealnameService;
import com.heima.user.service.ApUserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "app用户实名认证API", tags = "app用户实名认证API")
@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController {
    @Autowired
    ApUserRealnameService service;
    @Autowired
    ApUserService apUserService;

    @PostMapping("/list")
    public ResponseResult getListByStatus(@RequestBody AuthDTO dto){
        return service.getListByStatus(dto);
    }

    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDTO dto){
        return apUserService.updateStatus(dto, AdminConstants.FAIL_AUTH);
    }

    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDTO dto){
        return apUserService.updateStatus(dto,AdminConstants.PASS_AUTH);
    }
}
